/*
 * @Author: Zeratul
 * @Date: 2020-08-19 17:33:01
 * @LastEditTime: 2020-08-26 20:18:01
 * @FilePath: \sz-h5-2003-react-mobile\zhangminhui\eleme-react\eleme-user\src\Routes\index.js
 */
import React from "react";
import { BrowserRouter as Router, Route,} from "react-router-dom";
import HomePage from "../pages/HomePage";
import { Switch } from "react-router-dom/cjs/react-router-dom.min";
import LoginPage from "../pages/LoginPage";
import UserPage from "../pages/UserPage";
import SettingPage from "../pages/SettingPage";
import _404Page from "../pages/_404Page";
import RegistPage from "../pages/RegistPage";
import CartPage from "../pages/CartPage";
import CollectionPage from "../pages/CollectionPage";
import AddressPage from "../pages/AddressPage/address";
import AddAddressPage from "../pages/AddressPage/addAddress";
import UpdateAddressPage from "../pages/AddressPage/updateAddress";
import Map from "../pages/AddressPage/map"
import DiscoverPage from "../pages/DiscoverPage";
import OrderPage from "../pages/OrderPage";
import OrderDetailPage from "../pages/OrderDetail/OrderDetailPage";  
import BottomNav from "../components/BottomNav";
import FoodStore from "../pages/FoodStore";
import FoodOrder from "../components/foodStore/FoodOrder"
import Comment from "../components/foodStore/Comment"
import Merchant from "../components/foodStore/Merchant";
import ConfirmPayment from "../components/foodStore/ConfirmPayment"
import ChatPage from "../pages/ChatPage";
import OrderComment from "../pages/Ordercomment";
import PrivateRoute from "./PrivateRoute";


// 配置路由
export default function Routs(props) {
  return (
    <Router>
      <Switch>
        <Route path="/" exact render={()=><BottomNav><HomePage/></BottomNav>}></Route>
        <Route path="/discover" render={()=><BottomNav><DiscoverPage/></BottomNav>}></Route>
        <PrivateRoute path="/order" render={()=><BottomNav><OrderPage/></BottomNav>}></PrivateRoute>
        <Route path="/user"  render={()=><BottomNav><UserPage/></BottomNav>}></Route>
        <Route path="/login" render={()=><LoginPage/>}></Route>
        <Route path="/regist" render={()=><RegistPage/>}></Route>
        <PrivateRoute path='/chat' render={()=><ChatPage/>}></PrivateRoute>
        {/* 点击店铺跳转时，传递一个店铺id */}
        <PrivateRoute exact path="/foodStore/order/:storeId" render={()=><FoodStore><FoodOrder></FoodOrder></FoodStore>}></PrivateRoute>
        <PrivateRoute exact path="/foodStore/comment/:storeId" render={()=><FoodStore><Comment></Comment></FoodStore>}></PrivateRoute>
        <PrivateRoute exact path="/foodStore/merchant/:storeId" render={()=><FoodStore><Merchant></Merchant></FoodStore>}></PrivateRoute>
        <PrivateRoute path="/foodStore/confirmPayment" render={()=><ConfirmPayment></ConfirmPayment>}></PrivateRoute>
        
        <PrivateRoute path="/setting" render={()=><SettingPage/>}></PrivateRoute>
        <PrivateRoute path="/cart" render={()=><CartPage/>}></PrivateRoute>
        <PrivateRoute path="/collection" render={()=><CollectionPage/>}></PrivateRoute>
        <PrivateRoute path="/address" render={()=><AddressPage/>}></PrivateRoute>
        <PrivateRoute path="/addAddress" render={()=><AddAddressPage/>}></PrivateRoute>
        <PrivateRoute path="/updateAddress" render={()=><UpdateAddressPage/>}></PrivateRoute>
        <PrivateRoute path="/map" render={()=><Map/>}></PrivateRoute>
        <PrivateRoute exact path="/orderdetail" render={()=><OrderDetailPage/>}></PrivateRoute>
        <PrivateRoute exact path="/ordercomment" render={()=><OrderComment/>}></PrivateRoute>
        <Route component={_404Page}/>
      </Switch>
    </Router>
  );
}
